<?php
$v_cate_type="CATE";
if(isset($_REQUEST['cate_type'])){
	$v_cate_type=$_REQUEST['cate_type'];
}
switch($v_cate_type) {
	case "CATE";
		$v_question_lable = CONST_QA_QUESTION_LABEL;
		$v_answer_lable = CONST_QA_ANSWER_LABEL;
	break;
	case "IDEA";
		$v_question_lable = CONST_QA_IDEA_LABEL;
		$v_answer_lable = CONST_QA_ANSWER_LABEL;
	break;
	case "RESULT";
		$v_question_lable = CONST_QA_QUESTION_LABEL;
		$v_answer_lable = CONST_QA_ANSWER_LABEL;
	break;
	case "OTHER";
		$v_question_lable = CONST_QA_QUESTION_LABEL;
		$v_answer_lable = CONST_QA_ANSWER_LABEL;
	break;
	case "REGISTER";
		$v_question_lable = CONST_QA_REGISTER_LABEL;
		$v_answer_lable = CONST_QA_ANSWER_LABEL;
	break;
}


$v_qa_id = 0;
if(isset($_REQUEST['qa_id'])){
	$v_qa_id = intval($_REQUEST['qa_id']);
} 
$v_type_question = 0;
$v_type_answer = 1;
if ($v_qa_id >0) {
	if(_is_sqlserver()){
		$sql = "Onegate_QAQuestionGetSingle " . $v_qa_id;
		$ado_conn->SetFetchMode(ADODB_FETCH_ASSOC);
		$arr_single_qa_question = $ado_conn->GetRow($sql); 
		// Lay cac file dinh kem cau hoi
		$cmd = @mssql_init("Onegate_QAAttachFileGetAll",$conn);
		@mssql_bind($cmd,"@p_qa_id",$v_qa_id,SQLINT4);
		@mssql_bind($cmd,"@p_type",$v_type_question,SQLINT4);
		$result = @mssql_execute($cmd);
		$arr_question_file = _get_row_to_array($result);
		$v_total_question_file = sizeof($arr_question_file);
		@mssql_free_result($result);
		// Lay cac file dinh kem cau tr loi
		$cmd = @mssql_init("Onegate_QAAttachFileGetAll",$conn);
		@mssql_bind($cmd,"@p_qa_id",$v_qa_id,SQLINT4);
		@mssql_bind($cmd,"@p_type",$v_type_answer,SQLINT4);
		$result = @mssql_execute($cmd);
		$arr_answer_file = _get_row_to_array($result);
		$v_total_answer_file = sizeof($arr_answer_file);
		@mssql_free_result($result);
	}
}?>